#
# @lc app=leetcode.cn id=83 lang=python3
#
# [83] 删除排序链表中的重复元素
#
class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next
# @lc code=start

class Solution:
    def deleteDuplicates(self, head: ListNode) -> ListNode:
        if head == None:
            return None
        preVal = head.val
        temp = head.next
        preNode = head
        while temp is not None:
            if temp.val == preVal:
                preNode.next = temp.next
            else:
                preVal = temp.val
                preNode = temp
            temp = temp.next
        return head
# @lc code=end

